import request from "@/axios"
//幻灯片
export function bannerList(id) {
    let url = '/api/home/banner/'
    if(id!=undefined){
        url += id
    }
    return request.get(url)
}
//推荐产品
export function topList(page,id) {
    let limit = 6
    if(id==undefined||id==0){
        id=null
    }
    let url = '/api/goods/list'
    let params = {
        limit:limit,
        page:page,
        type:id
    }
    return request.get(url,{params})
}

//产品详情
export function detail(id) {
    let url = '/api/home/goods/info/'+id
    return request.get(url)
}

//菜单栏
export function getMenubarList() {
    let url = '/api/saleTypes/list'
    return request.get(url)
}

//tabBar分类
export function getTabBarType(){
    let url ='/api/mallType/findBigType'
    return request.get(url)
}

//获取头条推荐商品
export  function getHeadGoods(id){
    let url = '/api/mallType/findByPid/'+id
    return request.get(url)
}

//点击导航进入页面，获取商品列表
export function getSearchGoodsList(page,type,saleType){
    let url =
        `/api/saleTypes/BySaleTypeId?page=${page}&limit=10&type=0&saleType=${saleType}`
    return request.get(url)
}

export function getHeadLineList(id,page){
    let url=`/api/mallType/queryMallGoods/${id}/${page}/${10}`
    return request.get(url)
}

export function getSearchList(name,page,limit){
    let url=`/api/goods/search?name=${name}&page=${page}&limit=${limit}`
    return request.get(url)
}
